<?php
	require_once( 'core_DataBaseConnect.php' );
	require_once( 'core_ErrorCode.php' );
	require_once( 'core_Response.php' );
	require_once( 'core_FileManager.php' );
	require_once( 'dao_MemberDAO.php' );
	require_once( 'dao_ModelDAO.php' );
	require_once( '_configs.php' );
	
	function func( $con, $post, $returnType )
	{
		$login_member_id 	= $post[ 'login_member_id' ];
		// 0. 작성 권한 설정 ( 최고 관리자 or 운영자 )
		if( MemberDAO::isAccessable( $con, $login_member_id, array( configs::AUTHOR_ADMIN, configs::AUTHOR_MANAGER ) ) == false )
		{
			// 작성권한 없음
			return Response::FAIL( ErrorCode::FAIL_WRITE_AUTHOR, "작성권한이 없습니다.", $returnType );
		}
		
		
		$seqs			= $post[ 'seq' ];
		$orders			= $post[ 'order' ];
		
		while( is_array( $seqs ) && count( $seqs ) > 0 )
		{
			$seq = array_pop( $seqs );
			$order = array_pop( $orders );
			
			ModelDAO::updateModelHistoryOrder( $con, $seq, $order );
		}
		
		$response = array();
		$response[ 'code' ] = $post[ 'code' ];
		
		return Response::SUCCESS( $response, $returnType );
	}
?>